<?php

class TemplatesController extends AppController{
    var $name='Templates';
    var $components=array();
    
    
    
    function admin_index(){
        $data=$this->Template->find('all',array('conditions'=>array('Template.status ='=>'1')));
        $this->set('Templates',$data);
    }
    function admin_add(){
        
    }
    function admin_edit(){
       if(!empty($this->data)){
           if($this->Template->save($this->data)){
               $this->Session->setFlash("Template <b>". $this->data['Template']['title']."</b> saved");
               $this->redirect(array('controller'=>'Templates','action'=>'admin_index'));
           }else{
               $this->Session->setFlash('Template Not saved');
               $this->redirect(array('controller'=>'Templates','action'=>'admin_index'));
           }
           
           
       }
        
    }
    function admin_view(){
        
    }
    
    
}
?>
